//
//  NSObject+MSObject.h
//  PeopleForTheFirstMall
//
//  Created by iOS on 2020/7/2.
//  Copyright © 2020 MS. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (MSObject)


#pragma - mark - 获取字符串长度
/** 计算字符串长度（如果有表情，表情的长度为1）*/
- (NSInteger)ms_getStringLengthWithString:(NSString *)string;


#pragma mark - JSON
/** 转化为JSON data */
- (NSData *)ms_JSONData;
/** 转化为数组或字典 */
- (id)ms_JSONObject;
/** 转化为JSON字符串，如需去收尾空格和换行调用 removeleadingAndTrailingSpaces */
- (NSString *)ms_JSONString;
/** 转化为JSON字符串并去掉 \ */
- (NSString *)ms_JSONString_Filter;
/** 读取本地JSON文件 */
- (id)ms_JSONObjectForResource:(NSString *)name ofType:(NSString *)type;

#pragma mark -
/** 判断两个时间戳是否为同一天 */
- (BOOL)ms_isSameDay:(long)iTime1
               Time2:(long)iTime2;
/** 判断时间戳是否为未来时间 */
- (BOOL)ms_isFutureDays:(long)iTime;
/** 时间戳格式化为 年月日时分秒JSONString */
- (NSString *)ms_JSONStringWithTimeInterval:(double)timeInterval;
/** 获取当年当月第一天和最后一天(yyyy-MM-dd) */
- (NSArray *)ms_getMonthFirstAndLastDayWith:(NSString *)dateStr;


#pragma mark - 系统播报
/** 播报 */
- (void)ms_speech:(NSString *)string;
/** 播放通知铃声 */
- (void)ms_playSoundWithFilename:(NSString *)filename
                   fileExtension:(NSString *)fileExtension;

@end

NS_ASSUME_NONNULL_END
